<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@include file="common/header.jsp"%>
<style>

	 input{
	width: 80%;
	line-height: 33px;
	
	}
	
	#backbtn{
	width: 100px;
    height: 33px;
    background: #1CC09F;
    color: white;
    }
    
    a{
    color:white;
    
    }
    img{
    width:20%;
    heigth:20%;
    }
</style>

        <!-- /. NAV SIDE  -->
	<div id="page-wrapper">
		<div id="page-inner">
					<div class="col-lg-12">
						<h4></h4>
						<input type="hidden" name="id" value="${product.id }" /> 
						<input type="hidden" name="createBy" id="createBy" value="${product.createBy }" />
							<div class="input-group">
								<span class="input-group-addon">*商品名字：</span> <input type="text"
									id="productName" readonly="readonly"
									name="p_Name" value="${product.p_Name }" /> 
							</div>
							<br/>
							<div class="input-group">
								<span class="input-group-addon">*所属地区：</span> <input type="text"
									readonly="readonly" name="area"
									value="${product.area }">
							</div>
							<br/>
							<div class="input-group">
								<span class="input-group-addon">*联系人：&nbsp;&nbsp;&nbsp;&nbsp;</span>
								<input type="text" name="contact" readonly="readonly"
									value="${product.contact }">
							</div>
							<br/>
							<div class="input-group">
								<span class="input-group-addon">*联系电话：</span> <input type="text"
									name="phone" value="${product.phone }"
									readonly="readonly">
							</div>
							<br/>
							<div class="input-group">
								<span class="input-group-addon">*详细地址：</span> <input type="text"
									id="productaddress" name="address"  readonly="readonly"
									value="${product.address }">
							</div>
							<br/>
							<div class="input-group" id="in2">
								<span class="input-group-addon">单价：￥&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <input type="text"
									 name="price" value="${product.price }元"
									readonly="readonly">
							</div>
							<br/>
							<br/>
							<br/>
							<div class="input-group">
								<label for="desc">大概简介：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
								<textarea rows="3" cols="100"name="desc"
									readonly="readonly">${product.desc }</textarea>
							</div>
							<br />
							
							<br />
							<div class="input-group ">
								<label for="org_PicPath">营业许可证：</label> 
								<img id="org_PicPath" alt="" src="/pic/${product.org_PicPath}">
							</div>
							<br />
							<!-- <div class="input-group ">
								<label for="Pic_Path_1">简介照片：</label> <input type="file"
									name="attachs" id="Pic_Path_1" class="in1" 	readonly="readonly" />
							</div>
							<br />
							<div class="input-group ">
								<label for="Pic_Path_2">简介照片：</label> <input type="file"
									name="attachs" id="Pic_Path_2" class="in1" 	readonly="readonly" />
							</div> -->
							<br />
							<div class="input-group ">
								<label for="Pic_Path_1">简介照片：</label> 
									<img id="Pic_Path_1" alt="" src="/pic/${product.pic_Path_1}">
									<img id="Pic_Path_2" alt="" src="/pic/${product.pic_Path_2}">
									<img id="Pic_Path_3" alt="" src="/pic/${product.pic_Path_3}">
							</div>
							<br />
							
							<div class="input-group" >
								<!-- <span class="input-group-addon">所属分类：</span> -->
								<label>所属分类：</label> <select class="form-control" name="p_type"
									id="in3" >
									<c:if test="${product.p_type==1 }">
										<option value="1" selected="selected">景点</option>
										
									</c:if>
									<c:if test="${product.p_type==2 }">
										<option value="2" selected="selected">酒店</option>
									</c:if>
									<c:if test="${product.p_type==3 }">
										<option value="3" selected="selected">餐饮</option>
									</c:if>
									<c:if test="${product.p_type==4 }">
										<option value="3" selected="selected">套票</option>
									</c:if>

								</select>
							</div>
							<br />
							<div class="input-group" >
								<label>商品状态：</label> <select class="form-control" name="status">
									<c:if test="${product.status==0 }">
										<option value="0" selected="selected">下架</option>
									</c:if>
									<c:if test="${product.status==1 }">
										<option value="1" selected="selected">上架</option>
									</c:if>


								</select>
							</div>
							<br />

							<br /> <br /> <br /> 

							<div class="col-md-2 col-md-push-3" >
								<input type="button" id="backbtn" value="返回" />
							</div>
							<div class="col-md-2 col-md-push-4" id="box1" >
							
							</div>
					</div>
				</div>
			</div>

<footer>
	<p>
		
	</p>
</footer>


    <!-- JS Scripts-->
    <!-- jQuery Js -->
    <%@include file="common/js.jsp"%>
    <script>
     
    		$('#backbtn').on("click", function() {
    			history.back(-1);
    		});
    		
    		$('#productName').on("change",function(){
    			var pname = $('#productName').val();
    			var paddress = $("#productaddress").val();
    			isExist();
    		});
    		
    		$('#productaddress').on("change",function(){
    			var pname = $('#productName').val();
    			var paddress = $("#productaddress").val();
    			isExist();
    			});
    		
    		
    		 function isExist(){
    			var pname = $('#productName').val();
    			var paddress = $("#productaddress").val();
    			var proName = $('#createBy').val();
    			$.ajax({
    				url : "/Trip/provider/isExist",
    				data : {
    					pname : pname,
    					address : paddress,
    					createBy : proName
    				},
    				dataType : "json",
    				success : function(data) {
    					if (data == "noexist") { //如果已经存在，就返回提示信息
    						$('#productName').next().html("")
    					} else {
    						$('#productName').next().html("该商品已存在，请重新填入")
    						$('#productName').val("");
    						$("#productaddress").val("");
    					}
    				},
    				error : function(data) {
    					alert("验证失败");
    				}
    			});
    		}
    		
    		//当前商品是酒店，显示查看房型按钮
    		if($('#in3 option:selected').val()==2){
    		addroom();
    		}
    		function addroom(){
    		$('#box1').append(
    		"<span class='btn btn-primary'><a href='${pageContext.request.contextPath }/provider/roomlist?hotelName=${product.p_Name }'>查看房型信息</a></span>"
    		)
    		}
    		
    		
    		$('#getroom').on("click", function() {
    			
    		});
    		
    </script>
    
   
</body>
</html>
